import maya.cmds as cmds

def combine ():
	
	#Combine multiple Shape Nodes under single Transform
	
	sel = cmds.ls (selection = True)
	
	cmds.makeIdentity(sel, apply = True)

	shapes = cmds.listRelatives(sel[1:], shapes = True)
	transform = sel[0]

	for i in shapes:
		cmds.parent(i, transform,  relative = True, shape = True)



def alignAttach ():
	
	#Attach Shape nodes to Transform
	
	sel = cmds.ls (selection = True)
	
	import pivot
		
	pivot.align()
	
	driver = sel[0]
	driven = cmds.listRelatives(sel[1:], shapes = True)

	
	for obj in driven:
		
		cmds.rename (obj, '%sShape' %driver)
		
		cmds.parent(obj, driver,  relative = True, shape = True)
	
	cmds.delete(sel[1])
	
	
def attach ():
	
	#Attach Shape nodes to Transform
	
	sel = cmds.ls (selection = True)
	
	driver = sel[0]
	driven = cmds.listRelatives(sel[1], shapes = True)

	
	for obj in driven:
		
		cmds.parent(obj, driver,  relative = True, shape = True)
	
	cmds.delete(sel[1])